<div id="content" style="margin-bottom:0px">
  <h1><?php echo $heading_title; ?></h1>
  	<div id="booking-info">
	    <h2><?php echo $text_restaurant_info; ?></h2>
	    <div class="content">
	      <table class="form">
	        <tr>
	          <td><?php echo $text_restaurant_name; ?></td>
	          <td>
	          	<?php echo $restaurant_info['name'];?>
	          </td>
	        </tr>
	        <tr>
	          <td><?php echo $text_address; ?></td>
	          <td>
	          	<?php echo $restaurant_info['address'];?>,
	          	<?php echo $restaurant_info['district'];?>,
	          	<?php echo $restaurant_info['city'];?>
	          </td>
	        </tr>
	        <tr>
	          <td><?php echo $text_url; ?></td>
	          <td>
	          	<?php echo $restaurant_info['url'];?>
	          </td>
	        </tr>
	        <tr>
	          <td><?php echo $text_email; ?></td>
	          <td>
	          	<?php echo $restaurant_info['config']->get('config_email');?>
	          </td>
	        </tr>
	        <tr>
	          <td><?php echo $text_phone; ?></td>
	          <td>
	          	<?php echo $restaurant_info['config']->get('config_telephone');?>
	          </td>
	        </tr>
	      </table>
	    </div>
	    <h2><?php echo $text_booking_info; ?></h2>
	    <div class="content">
	      <table class="form">
	        <tr>
	          <td><span class="required">*</span> <?php echo $entry_num_of_people; ?></td>
	          <td><input type="text" name="num_of_people" value="" />
	          </td>
	        </tr>
	        <tr>
	          <td><span class="required">*</span> <?php echo $entry_date_booked; ?></td>
	          <td><input type="text" name="date_booked" value="" class="datetime" readonly="readonly" />
	          </td>
	        </tr>
	        <tr>
	          <td><span class="required">*</span> <?php echo $entry_email; ?></td>
	          <td><input type="text" name="email" value="<?php echo $this->customer->getEmail();?>" />
	          </td>
	        </tr>
	        <tr>
	          <td><span class="required">*</span> <?php echo $entry_telephone; ?></td>
	          <td><input type="text" name="telephone" value="<?php echo $this->customer->getTelephone();?>" />
	          </td>
	        </tr>
	        <tr>
	          <td><?php echo $entry_request_detail; ?></td>
	          <td><textarea name="request_detail" cols="60" rows="5"></textarea></td>
	        </tr>
	        <tr>
	          <td style="vertical-align:top">
	          	<b><?php echo $entry_captcha; ?></b>
	          </td>
	          <td>
	          	<input type="text" name="booking_captcha"/>
			    <br />
			    <img src="index.php?route=restaurant/booking/captcha" alt="" id="booking_captcha" /><br />
			    <br />
	          </td>
	        </tr>
	      </table>
	    </div>    
	    <div class="buttons" style="margin-bottom:0px">
	     	<?php if ($text_agree) { ?>
	        	<div class="right"><?php echo $text_agree; ?>
	        <?php } ?>
	        <input type="checkbox" name="agree" value="1" />
	        <a class="button" id="button-booking"><span><?php echo $button_booking; ?></span></a>
	      	<a onclick="$.fancybox.close();" class="button"><span><?php echo $button_cancel; ?></span></a>
	      </div>	
	    </div>
	</div>
</div>
<script type="text/javascript"><!--
$('.fancybox').fancybox();
//--></script> 
<script type="text/javascript"><!--
$('.datetime').datetimepicker({
	dateFormat: 'dd/mm/yy',
	timeFormat: 'hh:mm'
});
//--></script> 
<script type="text/javascript"><!--
$('#button-booking').bind('click', function() {
	$.ajax({
		type: 'POST',
		url: 'index.php?route=restaurant/booking/book&restaurant_id=<?php echo $restaurant_info['restaurant_id']; ?>',
		dataType: 'json',
		data: 'num_of_people=' + encodeURIComponent($('input[name=\'num_of_people\']').val()) + '&date_booked=' + encodeURIComponent($('input[name=\'date_booked\']').val()) + '&email=' + encodeURIComponent($('input[name=\'email\']').val()) + '&telephone=' + encodeURIComponent($('input[name=\'telephone\']').val()) + '&request_detail=' + encodeURIComponent($('textarea[name=\'request_detail\']').val()) + '&agree=' + encodeURIComponent($('input[name=\'agree\']:checked').val() ? $('input[name=\'agree\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'booking_captcha\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#button-booking').attr('disabled', true);
			$('#booking-info').before('<div class="attention"><img src="portal/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
		},
		complete: function() {
			$('#button-booking').attr('disabled', false);
			$('.attention').remove();
		},
		success: function(data) {
			if (data.error) {
				$('#booking-info').before('<div class="warning">' + data.error + '</div>');
			}
			
			if (data.success) {
				$('#booking-info').before('<div class="success">' + data.success + '</div>');
				
				$('input[name=\'num_of_people\']').val('');
				$('input[name=\'date_booked\']').val('');
				$('input[name=\'email\']').val('');
				$('input[name=\'telephone\']').val('');
				$('textarea[name=\'request_detail\']').val('');
				$('input[name=\'agree\']').removeAttr('checked');
				$('input[name=\'booking_captcha\']').val('');
				$('#booking_captcha').attr('src', 'index.php?route=restaurant/booking/captcha' + '&' + Math.random());
			}
		}
	});
});
//--></script> 